package com.lvmama.controller.rhino.order;

import com.lvmama.client.rhino.OrderClient;
import com.lvmama.common.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
@RequestMapping("/order")
public class OrderAnalysisController {

    @Autowired
    OrderClient orderClient;

    /**
     * @Title: orderAnalysis
     * @Description: 订单分析
     * @param @param model
     * @param @return 设定文件
     * @return String 返回类型
     * @throws
     */
    @RequestMapping(value = "/orderAnalysis",method = RequestMethod.GET)
    public String orderAnalysis(ModelMap model) {
        return "rhino/order/orderAnalysis";
    }

    @RequestMapping(value = "/orderChartData",method = RequestMethod.POST)
    @ResponseBody
    public Result<Map<String, Object>> orderChartData(String chooseTime, String userUseYear, String flag) {
        return orderClient.orderChartData(chooseTime,userUseYear,flag);
    }

    @RequestMapping(value = "/orderDataByCategory",method = RequestMethod.POST)
    @ResponseBody
    public Result<Map<String, Object>> orderDataByCategory(String chooseTime,
                                                    String userUseYear,String flag,String categoryName) {
        return orderClient.orderDataByCategory(chooseTime,userUseYear,flag,categoryName);
    }





}
